package objects;

import java.io.Serializable;

public class CombatEntity implements Serializable {

	private static final long serialVersionUID = -4887844834442286692L;
	private int maxHp;
	private int curHp;
	private int percentHp;
	private int maxMp;
	private int curMp;
	private int atk;
	private int def;

	public CombatEntity(int maxHp, int maxMp, int atk, int def) {
		this.maxHp = maxHp;
		this.curHp += maxHp;
		this.maxMp = maxMp;
		this.curMp = maxMp;
		this.atk = atk;
		this.def = def;
		this.percentHp = 100;
	}

	private void calcPercentHp() {

		this.percentHp = this.curHp * 100 / this.maxHp;

	}

	public int getPercentHp() {
		return this.percentHp;
	}

	public int getMaxHp() {
		return maxHp;
	}

	public void setMaxHp(int maxHp) {
		this.maxHp = maxHp;
		calcPercentHp();
	}

	public int getCurHp() {
		return curHp;
	}

	public void setCurHp(int curHp) {
		if (curHp <= this.maxHp) {
			this.curHp = curHp;
			calcPercentHp();
		}
	}

	public int getMaxMp() {
		return maxMp;
	}

	public void setMaxMp(int maxMp) {
		this.maxMp = maxMp;
	}

	public int getCurMp() {
		return curMp;
	}

	public void setCurMp(int curMp) {
		this.curMp = curMp;
	}

	public int getAtk() {
		return atk;
	}

	public void setAtk(int atk) {
		this.atk = atk;
	}

	public int getDef() {
		return def;
	}

	public void setDef(int def) {
		this.def = def;
	}

}
